home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: leeds.ac.uk!news
- From: Philw@psychology.leeds.ac.uk (Phil Worsley)
- Subject: VC++ 1.5 Newbie Question (Specialist problem)
- Message-ID: <1996Jan7.165443.15962@leeds.ac.uk>
- NNTP-Posting-Host: psc_pc047.leeds.ac.uk
- Organization: Department of Psychology
- Date: Sun, 7 Jan 1996 16:54:43 +0000 (GMT)
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
- Hope someone here can help.
-
- In VC++ 1.5, I'm trying to get some machine specific information for copy
- protection reasons. Nothing flash, just getting the volume serial number.
- But the _bios_disk functions don't work under Windows.
-
- So I'm trying to get _dosintx and function 69, to run, this should give
- access to the serial number. However it keeps GPF'ing on me. I'm not a VC++
- programmer by trade (I'm a lowly Novell sysop), I'm just trying to finish this
- program for a friend. (the original programmer had a nervous breakdown)
-
- The code I'm trying to use is this....
-
- #include <dos.h>
- #include <stdafx.h>
- #include <malloc.h>
-
- char __far *buffer;
-
- CString SerialNumber::generateSerialNumber()
- {
- union _REGS inregs, outregs;
- struct _SREGS segregs;
-
- buffer=(char __far *) _fmalloc(512);
- inregs.h.ah = 0x69 // fn 69:
- inregs.h.al = 0x00 // get serial number
- inregs.h.bl = 0x80 // Hard disk C:
- inregs.x.dx = _FP_OFF( buffer );
- segregs.ds = _FP_SEG( buffer );
- _intdosx( &inregs, &outregs, &segregs );
-
- CString serialno=CString(buffer);
-
- return serialno;
- }
-
- It compiles but GPF's immediately when I execute it, is there something that I
- haven't done? Or something I need to change in the Project Options?
-
- Is there something else I could use to give me the serial number?
-
- Please help someone.
-
- P.
-